package com.xuxueli.commontdemo.controller;
import com.xuxueli.commontdemo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/boot")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/hello")
    public String say() {
        System.out.println("Hello springboot");
        return "hello,this is a springboot demo！~";
    }

    @GetMapping("/login")
    public String login(@RequestParam("username") String username,@RequestParam("password") String password){
        String result= "username:"+username+",password:"+password;
        System.out.println(result);
        return(result);
    }

    @GetMapping("/getUser/{id}")
    public String GetUser(@PathVariable Long id){
        return userService.findById(id).toString();
    }

    @GetMapping("/find")
    public String findUser(){
        Long id=1000l;
        return userService.findById(id).toString();
    }

}

